<template>
	<view class="list">
		<view class="item" v-for="(friend,index) in newFriens" :key='index' @click="goUserDetail(friend.uuid)">
			<image :src="friend.avat" mode=""></image>
			<view class="cont">
				<view class="warp">
					<text>{{friend.userName}}</text>
					<image src="../../static/image/man.png" mode=""></image>
				</view>
				<text>{{friend.say_something}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import util from '../../utils/index.js'
	export default {
		data() {
			return {
				newFriens: []
			}
		},
		onLoad() {
			util.myRequest({
				url: '/addFriends/list'
			}).then(res => {
				let{uuid}=uni.getStorageSync('user')
				let meIndex=res.findIndex(item=>item.uuid===uuid)
				res.splice(meIndex,1)
				this.newFriens = res
			})

		},
		methods: {
			goUserDetail(uuid) {
				uni.navigateTo({
					url: '../userDetail/userDetail?uuid='+uuid
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ededed;
	}

	.list {
		background-color: #fff;

		>.item {
			display: flex;
			height: 107upx;
			align-items: center;
			border-bottom: 1px solid #CCCCCC;
			padding-left: 30upx;
			position: relative;

			image {
				width: 72upx;
				height: 72upx;
				border-radius: 8upx;
			}

			.cont {
				display: flex;
				flex-direction: column;
				font-size: 30upx;
				margin-left: 20upx;

				>.warp {
					display: flex;

					image {
						width: 25upx;
						height: 25upx;
					}
				}

				text:nth-last-child(1) {
					font-size: 23upx;
					color: #999;
				}
			}


			&:nth-last-child(1) {
				border: none;
			}
		}
	}
</style>
